class Solution {
    public int lengthOfLongestSubstring(String s) {
        int []hash=new int[128];
        int left=0,right=0,ret=0;
        char []ss=s.toCharArray();
        while(right<ss.length){
            hash[ss[right]]++;
            while(hash[ss[right]]>1){
                hash[ss[left++]]--;
            }
            ret=Math.max(ret,right-left+1);
            right++;
        }
        return ret;
    }
}